package com.example.hello;

import com.example.hello.client.Icon.BootstrapIconState;
import com.vaadin.ui.AbstractComponent;

public class BootstrapIcon extends AbstractComponent {

    public enum Alignment {
        LEFT, NONE, RIGHT
    }

    public enum IconFlip {
        HORIZONTAL, NONE, VERTICAL
    }

    public enum IconSize {
        DEFAULT, FIVE_TIMES, FOUR_TIMES, THREE_TIMES, TWO_TIMES, LARGE
    }

    public enum IconRotate {
        NONE, ROTATE_180, ROTATE_270, ROTATE_90
    }

    public BootstrapIcon() {
        this("icon-asterisk");
    }

    public BootstrapIcon(String iconType) {
        this(iconType, IconSize.DEFAULT);
    }

    public BootstrapIcon(String iconType, IconSize size) {
        setType(iconType);
        setIconSize(size);
    }

    @Override
    protected BootstrapIconState getState() {
        return (BootstrapIconState) super.getState();
    }

    public Alignment getAlignment() {
        return Alignment.valueOf(getState().getAlignment());
    }

    public void setAlignment(Alignment alignment) {
        getState().setAlignment(alignment.toString());
    }

    public boolean isBorder() {
        return getState().isBorder();
    }

    public void setBorder(boolean border) {
        getState().setBorder(border);
    }

    public IconFlip isFlipped() {
        return IconFlip.valueOf(getState().getFlipped());
    }

    public void setFlipped(IconFlip flipped) {
        getState().setFlipped(flipped.toString());
    }

    public IconRotate getIconRotate() {
        return IconRotate.valueOf(getState().getIconRotate());
    }

    public void setIconRotate(IconRotate iconRotate) {
        getState().setIconRotate(iconRotate.toString());
    }

    public IconSize getIconSize() {
        return IconSize.valueOf(getState().getIconSize());
    }

    public void setIconSize(IconSize iconSize) {
        getState().setIconSize(iconSize.toString());
    }

    public String getType() {
        return getState().getType();
    }

    public void setType(String iconType) {
        getState().setType(iconType);
    }

    public boolean isLight() {
        return getState().isLight();
    }

    public void setLight(boolean light) {
        getState().setLight(light);
    }

    public boolean isMuted() {
        return getState().isMuted();
    }

    public void setMuted(boolean muted) {
        getState().setMuted(muted);
    }

    public boolean isSpin() {
        return getState().isSpin();
    }

    public void setSpin(boolean spin) {
        getState().setSpin(spin);
    }

}
